package coroutines

import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import kotlinx.coroutines.withContext

fun main(){
    val mutext = Mutex()
    var counter = 0
    runBlocking {
        withContext(Dispatchers.Default){
            mutext.withLock {
                counter++
            }
        }
    }
}